﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using TestManagerClient.Model;

namespace TestManagerClient.Pages
{
    /// <summary>
    /// Interaction logic for JoinToCourse.xaml
    /// </summary>
    public partial class JoinToCourse : Page
    {
       public static List<Courses> CoursesList = new List<Courses>();
        public JoinToCourse()
        {
            InitializeComponent();
            titleTextBlock.Text = "Dołącz do kursu";

            InformationDisplay.HideNotification(notificationGrid, notificationTextBlock);
            InformationDisplay.HideWarning(warningGrid, warningTextBlock);
            InformationDisplay.HideError(errorGrid, errorTextBlock);

            btn_Join.IsEnabled = false;

            CoursesListBox.ItemsSource = CoursesList.Select(p=>p.Name);
        }

        private void closeNotificationGridButton_Click_1(object sender, RoutedEventArgs e)
        {

        }

        private void closeWarningGridButton_Click_1(object sender, RoutedEventArgs e)
        {

        }

        private void closeErrorGridButton_Click_1(object sender, RoutedEventArgs e)
        {

        }

        private void Courses_Selected(object sender, RoutedEventArgs e)
        {
            if (CoursesListBox.SelectedItem != null)
            {
                btn_Join.IsEnabled = true;
            }
            else
            {
                btn_Join.IsEnabled = false;
            }

        }

        private void btn_Join_Click_1(object sender, RoutedEventArgs e)
        {
            
            btn_Join.Command = NavigationCommands.GoToPage;
            btn_Join.CommandParameter = "Pages/CoursesPage.xaml";
        
        }

        private void btn_Close_Click_1(object sender, RoutedEventArgs e)
        {
            btn_Close.Command = NavigationCommands.GoToPage;
            btn_Close.CommandParameter = "Pages/CoursesPage.xaml";

        }
    }
}
